The disk isn't guaranteed to be the first device in the config sxp --
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sun, 26 Feb 2006 09:55:21 +0000 (10:55 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sun, 26 Feb 2006 09:55:21 +0000 (10:55 +0100)
make sure we can restart domains when using a boot loader even if not.

Signed-off-by: Jeremy Katz <katzj@redhat.com>
tools/python/xen/xend/XendDomainInfo.py

index 5db26c1d4beb02baf927bb988e10360123229396..9007a2ce49d40cc4c7565621e5708b2a580ed5dd 100644 (file)
@@ -1502,15 +1502,14 @@ class XendDomainInfo:
         if not self.info['bootloader']:
             return
         # if we're restarting with a bootloader, we need to run it
-        # FIXME: this assumes the disk is the first device and
-        # that we're booting from the first disk
         blcfg = None
         config = self.sxpr()
         # FIXME: this assumes that we want to use the first disk
-        dev = sxp.child_value(config, "device")
-        if dev:
-            disk = sxp.child_value(dev, "uname")
-            fn = blkdev_uname_to_file(disk)
+        for dev in sxp.children(config, "device"):
+            disk = sxp.child(dev, "vbd")
+            if disk is None:
+                continue
+            fn = blkdev_uname_to_file(sxp.child_value(disk, "uname"))
             blcfg = bootloader(self.info['bootloader'], fn, 1,
                                self.info['vcpus'])
         if blcfg is None: